package com.etc.medical.feign;


import com.etc.common.entity.BasicPatient;
import com.etc.common.utils.Result;
import com.etc.medical.client.BasicPatientClient;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@RestController
@RequestMapping("/patient")
@CrossOrigin(origins = "*")
public class BasicPatientFeign {
    @Resource
    private BasicPatientClient bpClient;

    /**
     * 查询医生Id下的正在治疗的病人信息
     *
     * @return
     */
    @RequestMapping("/queryByDocId")
    Result queryDocId(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestParam("docId") String docId) {
        return bpClient.queryDocId(pageNum, pageSize, docId);
    }


    /**
     * 新增病人信息
     *
     * @return
     */
    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    Result insert(BasicPatient basicPatient, @RequestParam("docId") String docId) {
        return bpClient.insert(basicPatient, docId);
    }

    /**
     * 修改病人信息
     *
     * @return
     */
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    Result update(BasicPatient basicPatient, @RequestParam("operatorId") String operatorId) {
        return bpClient.update(basicPatient, operatorId);
    }

    /**
     * 批量结束病人治疗
     *
     * @param ids
     * @param operatorId
     * @return
     */
    @RequestMapping(value = "/endPatient", method = RequestMethod.POST)
    Result endPatient(@RequestParam("ids") String[] ids, @RequestParam("operatorId") String operatorId) {
        return bpClient.endPatient(ids, operatorId);
    }
}
